\(\int \frac {\tan (x)}{\sqrt {a+b \cot ^2(x)}} \, dx\) [47]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 60 \[ \int \frac {\tan (x)}{\sqrt {a+b \cot ^2(x)}} \, dx=\frac {\text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )}{\sqrt {a}}-\frac {\text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right )}{\sqrt {a-b}} \]

[Out]

arctanh((a+b*cot(x)^2)^(1/2)/a^(1/2))/a^(1/2)-arctanh((a+b*cot(x)^2)^(1/2)/(a-b)^(1/2))/(a-b)^(1/2)

Rubi [A] (verified)

Time = 0.13 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3751, 457, 88, 65, 214} \[ \int \frac {\tan (x)}{\sqrt {a+b \cot ^2(x)}} \, dx=\frac {\text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )}{\sqrt {a}}-\frac {\text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right )}{\sqrt {a-b}} \]

[In]

Int[Tan[x]/Sqrt[a + b*Cot[x]^2],x]

[Out]

ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a]]/Sqrt[a] - ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a - b]]/Sqrt[a - b]

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 88

Int[((e_.) + (f_.)*(x_))^(p_)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Dist[b/(b*c - a*d), In
t[(e + f*x)^p/(a + b*x), x], x] - Dist[d/(b*c - a*d), Int[(e + f*x)^p/(c + d*x), x], x] /; FreeQ[{a, b, c, d,
e, f, p}, x] &&  !IntegerQ[p]

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 3751

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[c*(ff/f), Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2
 + ff^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \frac {1}{x \left (1+x^2\right ) \sqrt {a+b x^2}} \, dx,x,\cot (x)\right ) \\ & = -\left (\frac {1}{2} \text {Subst}\left (\int \frac {1}{x (1+x) \sqrt {a+b x}} \, dx,x,\cot ^2(x)\right )\right ) \\ & = -\left (\frac {1}{2} \text {Subst}\left (\int \frac {1}{x \sqrt {a+b x}} \, dx,x,\cot ^2(x)\right )\right )+\frac {1}{2} \text {Subst}\left (\int \frac {1}{(1+x) \sqrt {a+b x}} \, dx,x,\cot ^2(x)\right ) \\ & = -\frac {\text {Subst}\left (\int \frac {1}{-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+b \cot ^2(x)}\right )}{b}+\frac {\text {Subst}\left (\int \frac {1}{1-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+b \cot ^2(x)}\right )}{b} \\ & = \frac {\text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )}{\sqrt {a}}-\frac {\text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right )}{\sqrt {a-b}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.06 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.00 \[ \int \frac {\tan (x)}{\sqrt {a+b \cot ^2(x)}} \, dx=\frac {\text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )}{\sqrt {a}}-\frac {\text {arctanh}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right )}{\sqrt {a-b}} \]

[In]

Integrate[Tan[x]/Sqrt[a + b*Cot[x]^2],x]

[Out]

ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a]]/Sqrt[a] - ArcTanh[Sqrt[a + b*Cot[x]^2]/Sqrt[a - b]]/Sqrt[a - b]

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(148\) vs. \(2(48)=96\).

Time = 0.80 (sec) , antiderivative size = 149, normalized size of antiderivative = 2.48

method result size
default \(\frac {\sqrt {4}\, \left (\arctan \left (\frac {\sqrt {-\frac {a \cos \left (x \right )^{2}-\cos \left (x \right )^{2} b -a}{\left (\cos \left (x \right )+1\right )^{2}}}\, \left (\cot \left (x \right )+\csc \left (x \right )\right )}{\sqrt {-a +b}}\right ) \sqrt {a}+\operatorname {arctanh}\left (\frac {\sqrt {-\frac {a \cos \left (x \right )^{2}-\cos \left (x \right )^{2} b -a}{\left (\cos \left (x \right )+1\right )^{2}}}\, \left (\cot \left (x \right )+\csc \left (x \right )\right )}{\sqrt {a}}\right ) \sqrt {-a +b}\right ) \sqrt {-\frac {a \cos \left (x \right )^{2}-\cos \left (x \right )^{2} b -a}{\left (\cos \left (x \right )+1\right )^{2}}}\, \left (\cot \left (x \right )+\csc \left (x \right )\right )}{2 \sqrt {-a +b}\, \sqrt {a}\, \sqrt {a +b \cot \left (x \right )^{2}}}\) \(149\)

[In]

int(tan(x)/(a+b*cot(x)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

1/2*4^(1/2)/(-a+b)^(1/2)/a^(1/2)*(arctan(1/(-a+b)^(1/2)*(-(a*cos(x)^2-cos(x)^2*b-a)/(cos(x)+1)^2)^(1/2)*(cot(x
)+csc(x)))*a^(1/2)+arctanh(1/a^(1/2)*(-(a*cos(x)^2-cos(x)^2*b-a)/(cos(x)+1)^2)^(1/2)*(cot(x)+csc(x)))*(-a+b)^(
1/2))*(-(a*cos(x)^2-cos(x)^2*b-a)/(cos(x)+1)^2)^(1/2)/(a+b*cot(x)^2)^(1/2)*(cot(x)+csc(x))

Fricas [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 419, normalized size of antiderivative = 6.98 \[ \int \frac {\tan (x)}{\sqrt {a+b \cot ^2(x)}} \, dx=\left [\frac {{\left (a - b\right )} \sqrt {a} \log \left (2 \, a \tan \left (x\right )^{2} + 2 \, \sqrt {a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2} + b\right ) + \sqrt {a - b} a \log \left (\frac {{\left (2 \, a - b\right )} \tan \left (x\right )^{2} - 2 \, \sqrt {a - b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2} + 1}\right )}{2 \, {\left (a^{2} - a b\right )}}, -\frac {2 \, a \sqrt {-a + b} \arctan \left (-\frac {\sqrt {-a + b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}}{a - b}\right ) - {\left (a - b\right )} \sqrt {a} \log \left (2 \, a \tan \left (x\right )^{2} + 2 \, \sqrt {a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2} + b\right )}{2 \, {\left (a^{2} - a b\right )}}, -\frac {2 \, \sqrt {-a} {\left (a - b\right )} \arctan \left (\frac {\sqrt {-a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}}{a}\right ) - \sqrt {a - b} a \log \left (\frac {{\left (2 \, a - b\right )} \tan \left (x\right )^{2} - 2 \, \sqrt {a - b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2} + 1}\right )}{2 \, {\left (a^{2} - a b\right )}}, -\frac {\sqrt {-a} {\left (a - b\right )} \arctan \left (\frac {\sqrt {-a} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}}{a}\right ) + a \sqrt {-a + b} \arctan \left (-\frac {\sqrt {-a + b} \sqrt {\frac {a \tan \left (x\right )^{2} + b}{\tan \left (x\right )^{2}}}}{a - b}\right )}{a^{2} - a b}\right ] \]

[In]

integrate(tan(x)/(a+b*cot(x)^2)^(1/2),x, algorithm="fricas")

[Out]

[1/2*((a - b)*sqrt(a)*log(2*a*tan(x)^2 + 2*sqrt(a)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2 + b) + sqrt(a - b)
*a*log(((2*a - b)*tan(x)^2 - 2*sqrt(a - b)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2 + b)/(tan(x)^2 + 1)))/(a^2
 - a*b), -1/2*(2*a*sqrt(-a + b)*arctan(-sqrt(-a + b)*sqrt((a*tan(x)^2 + b)/tan(x)^2)/(a - b)) - (a - b)*sqrt(a
)*log(2*a*tan(x)^2 + 2*sqrt(a)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2 + b))/(a^2 - a*b), -1/2*(2*sqrt(-a)*(a
 - b)*arctan(sqrt(-a)*sqrt((a*tan(x)^2 + b)/tan(x)^2)/a) - sqrt(a - b)*a*log(((2*a - b)*tan(x)^2 - 2*sqrt(a -
b)*sqrt((a*tan(x)^2 + b)/tan(x)^2)*tan(x)^2 + b)/(tan(x)^2 + 1)))/(a^2 - a*b), -(sqrt(-a)*(a - b)*arctan(sqrt(
-a)*sqrt((a*tan(x)^2 + b)/tan(x)^2)/a) + a*sqrt(-a + b)*arctan(-sqrt(-a + b)*sqrt((a*tan(x)^2 + b)/tan(x)^2)/(
a - b)))/(a^2 - a*b)]

Sympy [F]

\[ \int \frac {\tan (x)}{\sqrt {a+b \cot ^2(x)}} \, dx=\int \frac {\tan {\left (x \right )}}{\sqrt {a + b \cot ^{2}{\left (x \right )}}}\, dx \]

[In]

integrate(tan(x)/(a+b*cot(x)**2)**(1/2),x)

[Out]

Integral(tan(x)/sqrt(a + b*cot(x)**2), x)

Maxima [F]

\[ \int \frac {\tan (x)}{\sqrt {a+b \cot ^2(x)}} \, dx=\int { \frac {\tan \left (x\right )}{\sqrt {b \cot \left (x\right )^{2} + a}} \,d x } \]

[In]

integrate(tan(x)/(a+b*cot(x)^2)^(1/2),x, algorithm="maxima")

[Out]

integrate(tan(x)/sqrt(b*cot(x)^2 + a), x)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 203 vs. \(2 (48) = 96\).

Time = 0.37 (sec) , antiderivative size = 203, normalized size of antiderivative = 3.38 \[ \int \frac {\tan (x)}{\sqrt {a+b \cot ^2(x)}} \, dx=-\frac {{\left (2 \, a \arctan \left (-\frac {a - b}{\sqrt {-a^{2} + a b}}\right ) - 2 \, b \arctan \left (-\frac {a - b}{\sqrt {-a^{2} + a b}}\right ) + \sqrt {-a^{2} + a b} \log \left (b\right )\right )} \mathrm {sgn}\left (\sin \left (x\right )\right )}{2 \, \sqrt {-a^{2} + a b} \sqrt {a - b}} + \frac {\frac {2 \, \sqrt {a - b} \arctan \left (\frac {{\left (\sqrt {a - b} \sin \left (x\right ) - \sqrt {a \sin \left (x\right )^{2} - b \sin \left (x\right )^{2} + b}\right )}^{2} - 2 \, a + b}{2 \, \sqrt {-a^{2} + a b}}\right )}{\sqrt {-a^{2} + a b}} + \frac {\log \left ({\left (\sqrt {a - b} \sin \left (x\right ) - \sqrt {a \sin \left (x\right )^{2} - b \sin \left (x\right )^{2} + b}\right )}^{2}\right )}{\sqrt {a - b}}}{2 \, \mathrm {sgn}\left (\sin \left (x\right )\right )} \]

[In]

integrate(tan(x)/(a+b*cot(x)^2)^(1/2),x, algorithm="giac")

[Out]

-1/2*(2*a*arctan(-(a - b)/sqrt(-a^2 + a*b)) - 2*b*arctan(-(a - b)/sqrt(-a^2 + a*b)) + sqrt(-a^2 + a*b)*log(b))
*sgn(sin(x))/(sqrt(-a^2 + a*b)*sqrt(a - b)) + 1/2*(2*sqrt(a - b)*arctan(1/2*((sqrt(a - b)*sin(x) - sqrt(a*sin(
x)^2 - b*sin(x)^2 + b))^2 - 2*a + b)/sqrt(-a^2 + a*b))/sqrt(-a^2 + a*b) + log((sqrt(a - b)*sin(x) - sqrt(a*sin
(x)^2 - b*sin(x)^2 + b))^2)/sqrt(a - b))/sgn(sin(x))

Mupad [B] (verification not implemented)

Time = 13.10 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.55 \[ \int \frac {\tan (x)}{\sqrt {a+b \cot ^2(x)}} \, dx=\frac {\mathrm {atanh}\left (\frac {\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}}{\sqrt {a-b}}+\frac {2\,\sqrt {a-b}\,\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}}{b}-\frac {2\,a\,\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}}{b\,\sqrt {a-b}}\right )}{\sqrt {a-b}}+\frac {\mathrm {atanh}\left (\frac {\sqrt {a+\frac {b}{{\mathrm {tan}\left (x\right )}^2}}}{\sqrt {a}}\right )}{\sqrt {a}} \]

[In]

int(tan(x)/(a + b*cot(x)^2)^(1/2),x)

[Out]

atanh((a + b/tan(x)^2)^(1/2)/(a - b)^(1/2) + (2*(a - b)^(1/2)*(a + b/tan(x)^2)^(1/2))/b - (2*a*(a + b/tan(x)^2
)^(1/2))/(b*(a - b)^(1/2)))/(a - b)^(1/2) + atanh((a + b/tan(x)^2)^(1/2)/a^(1/2))/a^(1/2)